/* 1. 聊天容器主样式 */
.ds_deepseek-chat-container {
  width: 900px;
  height: 100%;
  background-color: rgba(250, 247, 247, 0.5);
  position: relative;
  border-radius: 0 12px 12px 0;
  overflow: hidden;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
}

/* 2. 聊天头部 */
.ds_chat-header {
  padding: 16px 20px;
  background-color: #fff;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.ds_chat-logo {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ds_chat-logo span {
  color: #1890ff;
}

.ds_session-warning {
  font-size: 14px;
  color: #ff7a45;
  background-color: #fff8f5;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

/* 3. 消息列表容器 */
.ds_chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #f7f9fc;
  background-image: 
    linear-gradient(rgba(240, 242, 245, 0.8) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 242, 245, 0.8) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* 4. 单条消息基础样式 */
.ds_message {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  word-break: break-word;
  transition: transform 0.1s ease;
}

.ds_message:hover {
  transform: translateY(-1px);
}

/* 用户消息样式 */
.ds_chat-messages .ds_message.ds_user-message {
  align-self: flex-end;
  margin-left: auto;
  background-color: #1890ff;
  color: #fff !important;
  border-bottom-right-radius: 4px;
}

/* AI消息样式 */
.ds_chat-messages .ds_message.ds_assistant-message {
  align-self: flex-start;
  background-color: #fff;
  border: 1px solid #eee;
  border-bottom-left-radius: 4px;
}

/* 消息发送者 */
.ds_message-sender {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  opacity: 0.9;
}

/* 用户消息发送者 */
.ds_user-message .ds_message-sender {
  color: rgba(255, 255, 255, 0.9) !important;
  align-self: flex-end;
}

/* AI消息发送者 */
.ds_assistant-message .ds_message-sender {
  color: #1890ff;
}

/* 消息内容 */
.ds_message-content {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 6px;
}

/* 用户消息内容 */
.ds_user-message .ds_message-content {
  color: #fff !important;
}

/* 消息时间 */
.ds_message-time {
  font-size: 12px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
  align-self: flex-end;
}

.ds_message:hover .ds_message-time {
  opacity: 1;
}

/* 用户消息时间 */
.ds_user-message .ds_message-time {
  color: rgba(255, 255, 255, 0.7) !important;
}

/* AI消息时间 */
.ds_assistant-message .ds_message-time {
  color: #999;
}

/* 5. 加载中状态 */
.ds_loading .ds_typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.ds_loading .ds_typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #1890ff;
  animation: ds_typing 1.4s infinite ease-in-out both;
}

.ds_loading .ds_typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.ds_loading .ds_typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes ds_typing {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* 6. 输入区域 */
.ds_chat-input-area {
  padding: 12px 20px;
  background-color: #fff;
  border-top: 1px solid #eee;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  box-sizing: border-box;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.02);
}

.ds_message-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  transition: all 0.2s ease;
  outline: none;
  min-height: 60px;
  max-height: 120px;
  background-color: #fafafa;
}

.ds_message-input:focus {
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
  background-color: #fff;
}

.ds_message-input:disabled {
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
  border-color: #eee;
  box-shadow: none;
}

.ds_send-button {
  padding: 10px 18px;
  background-color: #1890ff;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
  align-self: flex-end;
  box-shadow: 0 2px 4px rgba(24, 144, 255, 0.2);
}

.ds_send-button:hover {
  background-color: #096dd9;
  box-shadow: 0 2px 6px rgba(24, 144, 255, 0.3);
}

.ds_send-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}

/* 7. 滚动条美化 */
.ds_chat-messages::-webkit-scrollbar {
  width: 6px;
}

.ds_chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.ds_chat-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
  transition: background 0.2s;
}

.ds_chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 8. 响应式适配 */
@media (max-width: 768px) {
  .ds_deepseek-chat-container {
    width: 100%;
    border-radius: 0;
  }

  .ds_chat-messages {
    padding: 12px;
  }

  .ds_message {
    max-width: 85%;
    padding: 10px 14px;
  }

  .ds_chat-messages .ds_message.ds_user-message {
    align-self: flex-end;
    margin-left: auto;
  }

  .ds_chat-input-area {
    padding: 10px 12px;
    gap: 8px;
  }

  .ds_send-button {
    padding: 8px 14px;
  }
}